home *** CD-ROM | disk | FTP | other *** search
- #define DEBUG 0
- /*
- TOWNS囲碁棋譜記録プログラム
- 1993/07/25 久保田俊也
-
- 93/07/25 banデ-タのダメのセルを操作する関数の集まり
-
-
- */
- #include <stdlib.h>
- #include "igo.h"
- #include "banx.h"
-
- #define MAX_DAMECELLSIZE MAX_BANSIZE*MAX_BANSIZE*4
- static DAMECELL *damecell=NULL;
- static DAMECELL *free_p;
-
- int damecell_init()
- {
- int i;
-
- if(damecell == NULL){
- damecell = (DAMECELL *)my_malloc( sizeof(DAMECELL) * MAX_DAMECELLSIZE);
- if( damecell == NULL){
- return -1;
- }
- }
-
- for(i=0;i<MAX_DAMECELLSIZE-1;i++){
- damecell[i].next = &damecell[i+1];
- damecell[i].ichi = FREE_CELL; /* free_cell の意味で使っている */
- }
- damecell[MAX_DAMECELLSIZE-1].next = NULL;
- damecell[MAX_DAMECELLSIZE-1].ichi = FREE_CELL; /* free_cell の意味で使っている */
-
- free_p = &damecell[0];
- return 0;
-
- }
-
- int damecell_end()
- {
-
- if(damecell == NULL){
- return -1;
- }else{
- my_free(damecell);
- return 0;
- }
- }
-
- DAMECELL *damecell_get()
- {
- DAMECELL *wk_te;
-
- if(free_p == NULL){
- return NULL;
- }else{
- wk_te = free_p;
- free_p = free_p->next;
- return wk_te;
- }
-
- }
-
- int damecell_free(DAMECELL *p)
- {
-
- p->next = free_p;
- p->ichi = FREE_CELL;
- free_p = p;
- return 0;
- }
-
-